package handler

import (
	"2212b/awesome5Project12/api/request"
	"2212b/awesome5Project12/queue"
	"github.com/gin-gonic/gin"
	"net/http"
)

func AddAdmin(c *gin.Context) {
	var req request.AddAdminReq
	err := c.ShouldBind(&req)
	if err != nil {
		c.JSON(http.StatusOK, gin.H{
			"code": 10000,
			"msg":  "参数信息错误",
			"data": err.Error(),
		})
		return
	}
	queue.PublishPub("admin_send_all", req.Message)
	c.JSON(http.StatusOK, gin.H{
		"code": http.StatusOK,
		"msg":  "成功",
		"data": true,
	})
}
